﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Data;
using System.Drawing;

namespace DELVE_GAME
{
    public class Group
    {
        HashSet<Tile> tiles;

        public Group(Group currentGroup) {
            this.tiles = new HashSet<Tile>(currentGroup.tiles);
        }

        public Group(HashSet<Tile> tiles)
        {
            this.tiles = tiles;
        }

        public bool isInGroup(Tile tile)
        {
            return tiles.Contains(tile);
        }

        //determines if all tiles in territory are filled with one player
        public bool isOccupiedBy(int playerIndex)
        {
            bool occupied = true;
            foreach (Tile t in tiles)
            {
                if (!t.isOccupied() || !Virus.isFriend(playerIndex, t.getVirus()))
                    occupied = false;
            }
            return occupied;
        }

        public int getNumTiles() { return tiles.Count; }
    }
}
